package cn.alusiaor.springbootsecurity.controller;

import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author alusiaor
 * @title: NotFoundException
 * @projectName learnspringboot
 * @description: TODO
 * @date 2019/12/1516:36
 */
@Controller
public class NotFoundException implements ErrorController {

    @Override
    public String getErrorPath() {
        return "/error";
    }

    @RequestMapping(value = {"/error"})
    @ResponseBody
    public void error() throws Exception {
        throw new Exception("服务异常");
    }
}
